AngouriMath

Navigation

Setting`1


← Back to list of classes

Description

Summary

This class for configuring some internal mechanisms from outside

Type parameter "T"

Those configurations can be of different types

Remarks

A setting is one object for the whole process, and what it holds is per *flow*, not
per thread: the stack of values lives in an AsyncLocal`1. A scope
opened before an await is therefore still in force after it, and a
scope opened inside a task is invisible to that task's siblings and to whatever
started it. Backing the field with [ThreadStatic] gave neither: a continuation
resumed on a pool thread saw the defaults, and a thread returned to the pool carried
whatever scope was left on it into the next caller.
The frames are immutable, which is what makes the reference safe to share. An
AsyncLocal`1 copies on assignment to Value and on nothing else, so if a frame could be mutated in place, two flows holding the
same chain would write over each other. Pushing and popping therefore build a new
chain and assign it, rather than editing one.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online